package dlally;

import java.util.Scanner;

import dlally.model.DecisionLinesEvent;
import dlally.view.GameFieldGUI;

public class Main {


	public static void main(String[] args) {
		int numRounds = 0;
		int numPlayers = 0;
		Scanner sc = new Scanner(System.in);
		
		// Make sure they enter a valid number
		do{
			System.out.print("\nPlease enter number of rounds, between 3 and 8: ");
			// Check if int
			if(sc.hasNextInt()){
				numRounds = sc.nextInt();
			}
			else
				sc.next();
		// Loop if its an invalid int
		} while(numRounds == 0 || numRounds > 8 || numRounds < 3);
		
		// Make sure the number of players is valid
		do{
			// Prompt user
			System.out.print("\nPlease enter number of players, between 3 and 8: ");
			// Check if its an int
			if(sc.hasNextInt()){
				numPlayers = sc.nextInt();
			}
			else
				sc.next();
		// Loop if its an invalid int
		} while(numPlayers == 0 || numPlayers > 8 || numPlayers < 3);

		// Construct a gamefield
		DecisionLinesEvent m = new DecisionLinesEvent(numRounds, numPlayers);
		GameFieldGUI g = new GameFieldGUI(m);
		g.setVisible(true);
	}

}
